/**
 * filename: PersonManagerImpl.java
 * create time: 2009-4-11 下午08:15:35
 */
package org.lstc.say.homework.biz;

import org.lstc.say.homework.entity.Person;

import com.opensymphony.xwork2.ActionContext;

/**
 * @author sai
 *
 */
public class PersonManagerImpl implements PersonManager {
	private String name = null;
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	private Person person = null;
	
	public void setPerson(Person person) {
		this.person = person;
	}
	
	/* (non-Javadoc)
	 * @see org.lstc.say.homework.biz.PersonManager#execute()
	 */
	@Override
	public String execute() {	
		if(name != null) {
		ActionContext.getContext().getSession().put("sayhello", person.sayHello(name));
		ActionContext.getContext().getSession().put("saygoodbye", person.sayGoodbye(name));
		return "success";
		}
		return "error";
	}

}
